import { getUserInfoUrl, getUserTypeValue } from "@/command/apiTool";
import { useDetail, useList } from "@/hooks";
import { useRoute } from "vue-router";
export const useRequest = () => {
  const route = useRoute();
  const position = localStorage.getItem("positionData") as string;
  const positionJSON = JSON.parse(position) as {
    latitude: string;
    longitude: string;
  };
  //示范点详情
  const [detailinfo] = useDetail(
    getUserInfoUrl(
      {
        dh: "/api/H5/farmerBase/getDetailById",
        xh: "/api/H5/farmerBase/getDetailById",
      },
      {
        id: route.query.id,
        lat: positionJSON.latitude,
        lng: positionJSON.longitude,
      }
    ),
    {
      name: "",
      startTime: "",
      endTime: "",
      phone: "",
      address: "",
      introduce: "",
      distance: "",
      img: "",
      vrFile: "",
      deviceList: [], // 使用设备
      honorList: [], // 获得荣誉
      productList: [], // 种植品种
    }
  );

  return {
    detailinfo,
  };
};
